<!--
 * @Descripttion: 
 * @version: 
 * @Author: ada.wu
 * @Date: 2023-09-12 17:54:30
 * @LastEditors: ada.wu
 * @LastEditTime: 2024-03-08 11:17:18
-->
<template>
  <div>
    <van-collapse v-model="activeNames">
      <van-collapse-item v-for="(item,index) in kindList" :key="index" :name="`${index}`">
        <template #title>
          {{index+1}}{{item.kindName}}
        </template>
        <template #value>
          {{item.premium}}元
        </template>
        <div class="text-gray">
          <div class="flex align-center p-b-sm justify-between">
            <div>生效日期</div>
            <div class="text-black">{{item.startDate}}</div>
          </div>
          <div class="flex align-center p-b-sm justify-between">
            <div>保障期限</div>
            <div class="text-black">
              <template v-if="item.periodType=='1'">{{item.endDate}}</template>
              <template v-else-if="item.periodType=='2'">至{{item.endDate}}岁</template>
              <template v-else-if="item.periodType=='9'">终身</template>
            </div>
          </div>
          <div class="flex align-center p-b-sm justify-between">
            <div>交费方式</div>
            <div class="text-black">{{payWay[item.payWay]}}</div>
          </div>
          <div class="flex align-center p-b-sm justify-between">
            <div>交费期限</div>
            <div class="text-black" v-if="item.deadline=='0'">趸交</div>
            <div class="text-black" v-else>{{item.deadline}}年</div>
          </div>
          <div class="flex align-center p-b-sm justify-between">
            <div>基本保额</div>
            <div class="text-black">{{item.amount}}元</div>
          </div>
          <div class="flex align-center p-b-sm justify-between">
            <div>保费</div>
            <div class="text-black">{{item.premium}}元</div>
          </div>
        </div>
      </van-collapse-item>

    </van-collapse>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted, reactive, ref, toRefs } from "vue";
import policyEscrowConfig from "/@/hooks/policyEscrowConfig";
import { PERSON_ID_TYPE } from "/@/hooks/familyConfig";
import { Collapse, CollapseItem } from "vant";
export default defineComponent({
  props: {
    policyDto: {
      type: Object,
      default: "",
    },
    kindList: {
      type: Array,
    },
  },
  components: {
    [Collapse.name]: Collapse,
    [CollapseItem.name]: CollapseItem,
  },
  setup(props, { emit }) {
    const activeNames = ref([]);

    let { policyDto } = props;
    const isMotor = () => {
      if (policyDto.productType && policyDto.productType == "MOTOR")
        return true;
      else return false;
    };

    const isLife = () => {
      if (policyDto.productType && policyDto.productType == "LIFE") return true;
      else return false;
    };
    const isNoMotor = () => {
      if (policyDto.productType && policyDto.productType == "NOMOTOR")
        return true;
      else return false;
    };

    return {
      ...toRefs(props),
      activeNames,
      isMotor,
      isLife,
      isNoMotor,
      PERSON_ID_TYPE,
      ...policyEscrowConfig(),
    };
  },
});
</script>
<style lang="scss">
.vux-popup-header-right {
  color: #ff8e1c;
}
</style>

